<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>名家作品_可观艺术</title>
<meta name="Keywords" content="名家作品,可观艺术,油画大师作品,国画大师作品" />
<meta name="Description" content="名家作品列表,名家作品鉴赏,油画大师作品鉴赏,国画大师作品鉴赏" />
<link href="../style/common.css" rel="stylesheet" type="text/css" />
<link href="../style/painting.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx }/js/jquery-1.3.2.js"></script>
<style type="text/css">
.type_checked{font-size:12px;background: url('${ctx }/images/bz1.png') no-repeat;float:left;width:35px;height:28px;margin-left: 10px;padding:8px 0px 0px 8px;color:#999;cursor: pointer;}
.type_notcheck{font-size:12px;background: url('${ctx }/images/bz2.png') no-repeat;float:left;width:35px;height:28px;margin-left: 10px;padding:8px 0px 0px 8px;color:#999;}
.nodata{display:none; height:32px; line-height:32px; text-align:center; color:#999; font-size:14px}
</style>
<script type="text/javascript">
var cur_page = '${param.pageNo}';
var total_page = 1;
$(function(){
	var j = 1;
	getData_by_page(cur_page);
	var winH = $(window).height(); //页面可视区域高度
	$(window).scroll(function () {
		var scrollT = document.documentElement.scrollTop + document.body.scrollTop;
		var pageH = $(document.body).height();
		var winH = $(window).height(); //页面可视区域高度
		var aa = (pageH-winH-scrollT)/winH;  
		if ( aa<0.02 ) {
			if (j >= 10) {
				if(cur_page < total_page){
					var next_page = cur_page+1;
					$(".nodata").show().html("别滚动了，已经到底了。。。<a href=\"${ctx}/front/all_paintings_painterstar.jsp?type=${param.type}&pageNo="+next_page+"\">下一页</a>");
				}else{
					$(".nodata").show().html("别滚动了，已经到底了。。。");
				}
				return; //控制最大只能加载10页
			}
			cur_page++;
			j++;
			getData_by_page(cur_page);
		}
	});
});

function getData_by_page(page){
	$.getJSON("${ctx}/p/paintingAction!query_ajax.do?type=${param.type}",{pageNo:page},function(json){
		if(json){
			var page = json.page;
			var arrays = json.array;
			cur_page = page.pageNo;
			total_page = page.pageCount;
			var str = "";
			$.each(arrays,function(index,array){
				if(index%4 == 0){
					str +='<div class="row">';
				}
				str += '<div class="list"><div class="item">';
				str += '<div style="background-image: url(\''+array['middleImageApath']+'\');" class="pic">';
				str += '<a href="${ctx}/front/backgroundAction!showDetail.do?id='+array['id']+'"></a></div>';
				str += '</div><div class="title_name">'+array['painterName']+'&nbsp;《'+array['title']+'》</div></div>';
                if(index == json.length -1 || (index+1) % 4 == 0){
					str +='<div style="clear: both;"></div></div>';
                }
			});
			$("#container").append(str);
		}else{
			$(".nodata").show().html("别滚动了，本页已到底。。。");
			return false;
		}
	});
}

function init_search_input(flag){
	if(flag == '1'){
		$("#painter_name_search").val("");
	}
	else if(flag == '0'){
		var old_val = $("#painter_name_search").val();
		if(old_val  == ""){
			$("#painter_name_search").val("找著名画家");
        }
	}
}
</script>

</head>
<body>

<%@include file="/commons/head.jsp"%>

<div class="main" style="margin-top: 5px;">

	<div style="width: 890px;margin: 0px auto; margin-top: 10px;margin-bottom: 5px;overflow: hidden;">
		<div>
			<c:if test="${param.type == '2'}">
				<div class="type_notcheck"><a href="${ctx}/front/all_paintings_painterstar.jsp?type=1" style="text-decoration: none;color: #999;">油画</a></div>
				<div class="type_checked"><a href="${ctx}/front/all_paintings_painterstar.jsp?type=2" style="text-decoration: none;color: #999;">国画</a></div>
			</c:if>
			<c:if test="${param.type == '1'}">
				<div class="type_checked"><a href="${ctx}/front/all_paintings_painterstar.jsp?type=1" style="text-decoration: none;color: #999;">油画</a></div>
				<div class="type_notcheck"><a href="${ctx}/front/all_paintings_painterstar.jsp?type=2" style="text-decoration: none;color: #999;">国画</a></div>
			</c:if>
		</div>
		<div style="float:left;position: relative;">
			<div style="position: absolute;z-index: 0;left: 150px;top: 0px;"><img src="${ctx }/images/search.jpg" usemap="#searchMap" border="0"/>
				<map name="searchMap">
					<area shape="rect" coords="315,5,380,25" href="javascript:searchPainter()"></area>
				</map>
			</div>
			<div style="position: absolute;z-index: 1;left: 155px;top: 5px;">
				<input style="height: 15px;line-height: 14px;padding: 5px;width: 290px;font-size: 14px;border: 0px;color: #979797;" name="painter_name_search" id="painter_name_search"  type="text" value="找著名画家" onfocus="init_search_input('1')" onblur="init_search_input('0')"/>
			</div>
		</div>
	</div>
    <div id="container"></div>
    <div class="nodata"></div> 

</div>
	
<%@include file="/commons/foot.jsp" %>

</body>

</html>